package com.ss.android.article.base.feature.feed.activity;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bytedance.article.common.c.TTUtils;
import com.bytedance.common.utility.Logger;
import com.bytedance.common.utility.UIUtils;
import com.facebook.drawee.drawable.ScalingUtils;
import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
import com.ss.android.article.base.app.AppData;
import com.ss.android.article.base.ui.ForeGroundImageView;
import com.ss.android.article.browser.R;
import com.ss.android.article.common.NightModeAsyncImageView;
import com.ss.android.image.AsyncImageView;
import com.ss.android.image.AvatarLoader;
import com.ss.android.image.model.ImageInfo;

import java.util.Iterator;
import java.util.LinkedList;

public class InfoLayout extends ViewGroup {
    public static final class Info {
        public boolean A;
        public boolean B;
        public boolean C;
        public boolean D;
        public boolean E;
        public boolean F;
        public boolean G;
        private static LinkedList<Info> H = new LinkedList();
        public int a;
        public int labelStyle;
        public String c;
        public String d;
        public String e;
        public String f;
        public String g;
        public String avatarUrl;
        public int i;
        public ImageInfo j;
        public String k;
        public String l;
        public String m;
        public String n;
        public String o;
        public String tinyTouTiaoUrl;
        public boolean q;
        public boolean r;
        public boolean s;
        public boolean t;
        public boolean u;
        public boolean v;
        public boolean w;
        public boolean x;
        public boolean y;
        public boolean z;

        private Info() {

        }

        public final void a() {
            this.a = 0;
            this.labelStyle = 0;
            this.c = null;
            this.d = null;
            this.e = null;
            this.f = null;
            this.g = null;
            this.j = null;
            this.avatarUrl = null;
            this.k = null;
            this.tinyTouTiaoUrl = null;
            if (H.size() <= 20) {
                Iterator v1 = H.iterator();
                do {
                    if (v1.hasNext()) {
                        if (v1.next() != this) {
                            continue;
                        }
                        return;
                    } else {
                        H.add(this);
                        break;
                    }
                } while (true);
                return;

            }
        }

        public static Info acquireInfo() {
            Info v0_1;
            if (H.size() > 0) {
                v0_1 = (Info) H.removeLast();
            } else {
                v0_1 = new Info();
            }

            return v0_1;
        }

        public final void c() {
            boolean v1 = true;
            boolean v0 = (this.a & 1) > 0;
            this.q = v0;
            v0 = (this.a & 2) > 0;
            this.r = v0;
            v0 = (this.a & 8) > 0;
            this.s = v0;
            v0 = (this.a & 4) > 0;
            this.t = v0;
            v0 = (this.a & 16) > 0;
            this.u = v0;
            v0 = (this.a & 32) > 0;
            this.v = v0;
            v0 = (this.a & 64) > 0;
            this.w = v0;
            v0 = (this.a & 128) > 0;
            this.y = v0;
            v0 = (this.a & 256) > 0;
            this.z = v0;
            v0 = (this.a & 512) > 0;
            this.A = v0;
            v0 = (this.a & 1024) > 0;
            this.x = v0;
            v0 = (this.a & 2048) > 0;
            this.B = v0;
            v0 = (this.a & 4096) > 0;
            this.C = v0;
            v0 = (this.a & 8192) > 0;
            this.D = v0;
            v0 = (this.a & 16384) > 0;
            this.E = v0;
            v0 = (this.a & 32768) > 0;
            this.F = v0;
            if ((this.a & 65536) <= 0) {
                v1 = false;
            }

            this.G = v1;
        }

        public final boolean equals(Object arg5) {
            boolean v0 = true;
            if (this != arg5) {
                if (arg5 != null && this.getClass() == arg5.getClass()) {
                    if (this.a != ((Info) arg5).a) {
                        v0 = false;
                    } else if (this.labelStyle != ((Info) arg5).labelStyle) {
                        v0 = false;
                    } else {
                        if (this.c != null && this.c.equals(((Info) arg5).c) || ((Info) arg5).c == null) {
                            if (this.d != null && this.d.equals(((Info) arg5).d) || ((Info) arg5).d == null) {
                                if (this.avatarUrl != null && this.avatarUrl.equals(((Info) arg5).avatarUrl) || ((Info) arg5).avatarUrl == null) {
                                    if (this.e != null && this.e.equals(((Info) arg5).e) || ((Info) arg5).e == null) {
                                        if (this.f != null && this.f.equals(((Info) arg5).f) || ((Info) arg5).f == null) {
                                            if (this.g != null && this.g.equals(((Info) arg5).g) || ((Info) arg5).g == null) {
                                                if (this.k != null && this.k.equals(((Info) arg5).k) || ((Info) arg5).k == null) {
                                                    if (this.j != null && this.j.equals(((Info) arg5).j) || ((Info) arg5).j == null) {
                                                        return v0;
                                                    }
                                                    return false;
                                                }

                                                return false;
                                            }

                                            return false;
                                        }

                                        return false;
                                    }

                                    return false;
                                }

                                return false;
                            }

                            return false;
                        }

                        v0 = false;
                    }

                    return v0;
                }

                v0 = false;
            }

            return v0;
        }
    }

    final class b {
        c a;
        boolean b;
        String c;
        int d;

        public b(c arg1, int arg2) {
            this.a = arg1;
            this.d = arg2;
        }
    }

    final class c {
        boolean a;
        String b;
        int c;
        int d;
        int e;
        int f;
        int g;
        int h;
        Rect i;

        c(byte arg1) {
            this();
        }

        private c() {

            this.i = new Rect();
        }
    }

    private int mSourceIconMaxWidth;
    private int mCommonTxtGap;
    private int C;
    private int D;
    private int E;
    private c F = new c((byte) 0);
    private c G = new c((byte) 0);
    private c H = new c((byte) 0);
    private c I = new c((byte) 0);
    private c J = new c((byte) 0);
    private c K = new c((byte) 0);
    public AvatarLoader mAvatarLoader;
    public ImageView mDislikeIcon;
    private b[] c = new b[5];
    private static final int[] d = new int[]{0, 4, 3, 1, 2};
    private TextView e;
    private ViewGroup.MarginLayoutParams f;
    private ForeGroundImageView mForegroundImageView;
    private ViewGroup.MarginLayoutParams mForegroundImageLayoutParams;
    private ViewGroup.MarginLayoutParams i;
    private AsyncImageView j;
    private ViewGroup.MarginLayoutParams k;
    private boolean l;
    private GradientDrawable m;
    private Paint n;
    private Paint.FontMetricsInt o;
    private int p;
    private Paint mCommonTxtPaint;
    private Paint.FontMetricsInt r;
    private int s;
    private ColorFilter t;
    private Info u;
    private ImageView mMoreIcon;
    private ViewGroup.MarginLayoutParams w;
    private int mCommonTxtColorResId;
    private Drawable y;
    private int mSourceIconHeight;

    public InfoLayout(Context arg3) {
        super(arg3);
        this.c();
    }

    public InfoLayout(Context arg3, AttributeSet arg4) {
        super(arg3, arg4);
        this.c();
    }

    public InfoLayout(Context arg3, AttributeSet arg4, int arg5) {
        super(arg3, arg4, arg5);
        this.c();
    }

    public static void a() {
    }

    private static void a(c arg3, String arg4, int arg5, Paint arg6, Paint.FontMetricsInt arg7, int arg8) {
        UIUtils.a(arg4, arg5 - (arg3.c + arg3.e), arg6, arg8, UIUtils.a);
        arg3.b = UIUtils.a.a;
        if (arg3.b == null || arg3.b.length() == 0) {
            arg3.a = true;
        } else {
            arg3.a = false;
            arg3.g = UIUtils.a.b + (arg3.c + arg3.e);
            arg3.h = arg3.d + arg3.f + arg7.descent - arg7.ascent;
        }
    }

    public final void a(Info info) {
        int v8 = 4;
        int v7 = 3;
        int v6 = 2;
        if (info == null) {
            Logger.throwException("info is null !!!");
        } else {
            info.c();
            this.u = info;
            info.y = false;
            if (this.u.u) {
                if (this.u.j != null) {
                    ImageInfo v1 = this.u.j;
                    int v0 = ((int) (1f * (((float) this.mSourceIconHeight)) / (((float) v1.mHeight)) * (((float) v1.mWidth))));
                    if (v0 > this.mSourceIconMaxWidth) {
                        v0 = this.mSourceIconMaxWidth;
                    }

                    if (v0 <= 0 || this.mSourceIconHeight <= 0) {
                        this.k.height = this.mSourceIconHeight;
                        this.k.width = this.getContext().getResources().getDimensionPixelSize(R.dimen.hr);
                    } else {
                        this.k.height = this.mSourceIconHeight;
                        this.k.width = v0;
                    }

                    this.j.setVisibility(View.VISIBLE);
                    android.support.design.a.setImage(this.j, v1);
                    if (!this.l) {

                    } else {
                        this.j.setColorFilter(this.t);
                    }
                } else {
                    this.j.setImageDrawable(this.y);
                    this.j.setVisibility(View.VISIBLE);
                }
            }

            if (this.u.y) {
                if (!android.support.design.a.isTextEmpty(this.u.avatarUrl)) {
                    this.mForegroundImageView.setVisibility(View.VISIBLE);
                    this.mAvatarLoader.loadAvatar(this.mForegroundImageView, this.u.avatarUrl);
                    if (this.l) {
                        this.mForegroundImageView.setColorFilter(this.t);
                    }
                    this.mForegroundImageView.setForeGroundDrawable(ContextCompat.getDrawable(this.getContext(), R.drawable.ci));
                } else {
                    if (android.support.design.a.isTextEmpty(this.u.d)) {

                    } else {
                        this.e.setVisibility(View.VISIBLE);
                        this.e.setText(this.u.d.substring(0, 1));
                        android.support.design.a.b(this.e, this.u.i);
                    }
                }
            }


            if (this.u.v) {
                android.support.design.a.a(this.getContext(), this.m);
                this.n.setColor(android.support.design.a.b(this.getContext(), this.u.labelStyle));
            }

            if (!this.u.w) {
                this.mDislikeIcon.setVisibility(View.GONE);
            }

            if (!this.u.x) {
                this.mMoreIcon.setVisibility(View.GONE);
            }

            this.c[0].b = this.u.t;
            this.c[1].b = this.u.q;
            this.c[v7].b = this.u.r;
            this.c[v8].b = this.u.s;
            this.c[v6].b = this.u.A;
            this.c[0].c = this.u.g;
            this.c[1].c = this.u.z ? "" : this.u.d;
            this.c[v7].c = this.u.e;
            this.c[v8].c = this.u.f;
            this.c[v6].c = this.u.k;
            this.requestLayout();
        }
    }

    public final void b() {
        if (this.u != null) {
            if (this.mForegroundImageView.getVisibility() == View.VISIBLE) {
                if (this.mAvatarLoader != null) {
                    this.mAvatarLoader.clear(this.mForegroundImageView);
                }

                this.mForegroundImageView.setVisibility(View.GONE);
                this.mForegroundImageView.setColorFilter(null);
            }

            if (this.e.getVisibility() == View.VISIBLE) {
                this.e.setVisibility(View.GONE);
            }

            if (this.j.getVisibility() == View.VISIBLE) {
                this.j.setVisibility(View.GONE);
                this.j.setColorFilter(null);
            }

            if (this.mDislikeIcon.getVisibility() != View.VISIBLE) {
                this.mDislikeIcon.setVisibility(View.VISIBLE);
            }

            this.mDislikeIcon.setOnClickListener(((View.OnClickListener) null));
            if (this.mMoreIcon.getVisibility() != View.VISIBLE) {
                this.mMoreIcon.setVisibility(View.VISIBLE);
            }

            this.mMoreIcon.setOnClickListener(((View.OnClickListener) null));
            this.u.a();
            this.u = null;
        }
    }

    private void c() {
        this.setWillNotDraw(false);
        AppData.getInstance();
        this.l = AppData.isNightMode();
        this.mDislikeIcon = new ImageView(this.getContext());
        this.mDislikeIcon.setImageResource(com.ss.android.article.browser.R.drawable.dislikeicon_textpage);
        this.i = new ViewGroup.MarginLayoutParams(-2, -2);
        this.i.leftMargin = ((int) UIUtils.dp2px(this.getContext(), 20f));
        this.addView(this.mDislikeIcon, this.i);
        this.mMoreIcon = new ImageView(this.getContext());
        this.mMoreIcon.setImageResource(com.ss.android.article.browser.R.drawable.p1);
        int v0 = ((int) UIUtils.dp2px(this.getContext(), 5f));
        this.mMoreIcon.setPadding(v0, v0, v0, v0);
        this.w = new ViewGroup.MarginLayoutParams(-2, -2);
        this.w.leftMargin = ((int) UIUtils.dp2px(this.getContext(), 20f));
        this.addView(this.mMoreIcon, this.w);
        this.j = new NightModeAsyncImageView(this.getContext());
        AsyncImageView v0_1 = this.j;
        GenericDraweeHierarchyBuilder v1 = new GenericDraweeHierarchyBuilder(this.getResources());
        v1.mActualImageScaleType = ScalingUtils.ScaleType.FIT_CENTER;
        v0_1.setHierarchy(v1.setPlaceholderImage(this.getResources().getDrawable(com.ss.android.article.browser.R.drawable.iw), GenericDraweeHierarchyBuilder.DEFAULT_SCALE_TYPE).build());
        this.j.setAdjustViewBounds(true);
        this.k = new ViewGroup.MarginLayoutParams(-2, ((int) UIUtils.dp2px(this.getContext(), 12f)));
        this.k.rightMargin = ((int) UIUtils.dp2px(this.getContext(), 5f));
        this.addView(this.j, this.k);
        this.j.setVisibility(View.GONE);
        this.mForegroundImageView = new ForeGroundImageView(this.getContext());
        this.mForegroundImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
        int v1_1 = ((int) UIUtils.dp2px(this.getContext(), 16f));
        this.mForegroundImageLayoutParams = new ViewGroup.MarginLayoutParams(v1_1, v1_1);
        this.mForegroundImageLayoutParams.rightMargin = ((int) UIUtils.dp2px(this.getContext(), 5f));
        this.addView(this.mForegroundImageView, this.mForegroundImageLayoutParams);
        this.mForegroundImageView.setVisibility(View.GONE);
        this.m = (GradientDrawable) this.getContext().getResources().getDrawable(R.drawable.gd);
        this.mCommonTxtColorResId = R.color.ky;
        this.e = new TextView(this.getContext());
        this.e.setTextSize(1, 10f);
        this.e.setTextColor(ContextCompat.getColor(this.getContext(), R.color.ssxinzi7));
        this.e.setBackgroundResource(com.ss.android.article.browser.R.drawable.circle_solid_mian7);
        this.e.setGravity(17);
        this.e.getPaint().setFakeBoldText(true);
        this.e.setVisibility(View.GONE);
        this.f = new ViewGroup.MarginLayoutParams(v1_1, v1_1);
        this.f.rightMargin = ((int) UIUtils.dp2px(this.getContext(), 5f));
        this.addView(this.e, this.f);
        this.mCommonTxtPaint = new Paint(1);
        this.mCommonTxtPaint.setTextSize(UIUtils.sp2px(this.getContext(), 12f));
        this.mCommonTxtPaint.setColor(ContextCompat.getColor(this.getContext(), this.mCommonTxtColorResId));
        this.r = this.mCommonTxtPaint.getFontMetricsInt();
        this.s = UIUtils.a(this.mCommonTxtPaint.measureText("…"));
        this.D = this.getResources().getColor(com.ss.android.article.browser.R.color.ky);
        this.E = this.D;
        this.n = new Paint(1);
        this.n.setTextSize(UIUtils.sp2px(this.getContext(), 12f));
        this.o = this.n.getFontMetricsInt();
        this.p = UIUtils.a(this.n.measureText("…"));
        this.t = TTUtils.getNightModeColorFilter();
        this.y = ContextCompat.getDrawable(this.getContext(), R.drawable.s7);
        this.mCommonTxtGap = ((int) UIUtils.dp2px(this.getContext(), 5f));
        c v0_2 = this.F;
        c v1_2 = this.F;
        int v2 = ((int) UIUtils.dp2px(this.getContext(), 2.5f));
        v1_2.e = v2;
        v0_2.c = v2;
        v0_2 = this.F;
        v1_2 = this.F;
        v2 = ((int) UIUtils.dp2px(this.getContext(), 0.75f));
        v1_2.f = v2;
        v0_2.d = v2;
        this.C = ((int) UIUtils.dp2px(this.getContext(), 90f));
        this.c[0] = new b(this.J, 0);
        this.c[1] = new b(this.G, 1);
        this.c[3] = new b(this.H, 3);
        this.c[4] = new b(this.I, 4);
        this.c[2] = new b(this.K, 2);
    }

    protected void onDraw(Canvas canvas) {
        if (this.u != null) {
            if ((this.u.v) && !this.F.a && this.F.b != null) {
                this.m.draw(canvas);
                canvas.drawText(this.F.b, ((float) (this.F.i.left + this.F.c)), ((float) (this.F.i.top + this.F.d - this.o.ascent)), this.n);
            }

            int v3 = this.c.length;
            for (int i = 0; i < v3; ++i) {
                b bVar = this.c[i];
                if ((bVar.b) && !bVar.a.a && bVar.a.b != null) {
                    if (bVar.d == 1 && (this.u.y)) {
                        int originColor = this.mCommonTxtPaint.getColor();
                        Paint paint = this.mCommonTxtPaint;
                        int color = this.l ? this.E : this.D;
                        paint.setColor(color);
                        canvas.drawText(bVar.a.b, ((float) bVar.a.i.left), ((float) (bVar.a.i.top - this.r.ascent)), this.mCommonTxtPaint);
                        this.mCommonTxtPaint.setColor(originColor);
                    } else {
                        canvas.drawText(bVar.a.b, ((float) bVar.a.i.left), ((float) (bVar.a.i.top - this.r.ascent)), this.mCommonTxtPaint);
                    }
                }
            }
        }
    }

    protected void onLayout(boolean arg11, int arg12, int arg13, int arg14, int arg15) {
        int v3;
        if (this.u != null) {
            int v2 = arg15 - arg13;
            int v0 = this.getPaddingLeft();
            int v1 = arg14 - arg12 - this.getPaddingRight();
            if (this.u.w) {
                v3 = (v2 - this.mDislikeIcon.getMeasuredHeight()) / 2;
                this.mDislikeIcon.layout(v1 - this.i.rightMargin - this.mDislikeIcon.getMeasuredWidth(), v3, v1 - this.i.rightMargin, this.mDislikeIcon.getMeasuredHeight() + v3);
            }

            if (this.u.x) {
                v3 = (v2 - this.mMoreIcon.getMeasuredHeight()) / 2;
                this.mMoreIcon.layout(v1 - this.w.rightMargin - this.mMoreIcon.getMeasuredWidth(), v3, v1 - this.w.rightMargin, this.mMoreIcon.getMeasuredHeight() + v3);
            }

            if (this.u.u) {
                v1 = (v2 - this.j.getMeasuredHeight()) / 2;
                v0 += this.k.leftMargin;
                this.j.layout(v0, v1, this.j.getMeasuredWidth() + v0, this.j.getMeasuredHeight() + v1);
                v0 += this.k.rightMargin + this.j.getMeasuredWidth();
            }

            if (this.u.y) {
                if (this.mForegroundImageView.getVisibility() == View.VISIBLE) {
                    v1 = (v2 - this.mForegroundImageView.getMeasuredHeight()) / 2;
                    v0 += this.mForegroundImageLayoutParams.leftMargin;
                    this.mForegroundImageView.layout(v0, v1, this.mForegroundImageView.getMeasuredWidth() + v0, this.mForegroundImageView.getMeasuredHeight() + v1);
                    v0 += this.mForegroundImageView.getMeasuredWidth() + this.mForegroundImageLayoutParams.rightMargin;
                } else if (this.e.getVisibility() == View.VISIBLE) {
                    v1 = (v2 - this.e.getMeasuredHeight()) / 2;
                    v0 += this.f.leftMargin;
                    this.e.layout(v0, v1, this.e.getMeasuredWidth() + v0, this.e.getMeasuredHeight() + v1);
                    v0 += this.e.getMeasuredWidth() + this.f.rightMargin;
                }
            }

            b[] v3_1 = this.c;
            int v4 = v3_1.length;
            for (v1 = 0; v1 < v4; ++v1) {
                b v5 = v3_1[v1];
                if ((v5.b) && !v5.a.a) {
                    int v6 = (v2 - v5.a.h) / 2;
                    v5.a.i.set(v0, v6, v5.a.g + v0, v5.a.h + v6);
                    v0 += v5.a.g + this.mCommonTxtGap;
                }
            }

            if (!this.u.v) {
                return;
            }

            if (this.F.a) {
                return;
            }

            v1 = (v2 - this.F.h) / 2;
            this.F.i.set(v0, v1, this.F.g + v0, this.F.h + v1);
            this.m.setBounds(this.F.i);
        }
    }

    protected void onMeasure(int arg14, int arg15) {
        int v3;
        c v1_1;
        c v0_1;
        int v7;
        int v6;
        if (this.u == null) {
            this.setMeasuredDimension(0, 0);
        } else {
            int v9 = View.MeasureSpec.getSize(arg14);
            int v2 = 0;
            int v10 = this.getPaddingBottom() + this.getPaddingTop();
            int v0 = this.getPaddingLeft() + this.getPaddingRight();
            int v1 = v9 - v0;
            if (this.u.w) {
                this.mDislikeIcon.measure(InfoLayout.getChildMeasureSpec(arg14, this.i.leftMargin + v0 + this.i.rightMargin, this.i.width), InfoLayout.getChildMeasureSpec(arg15, this.i.topMargin + v10 + this.i.bottomMargin, this.i.height));
                v1 -= this.mDislikeIcon.getMeasuredWidth() + this.i.leftMargin + this.i.rightMargin;
                v0 += this.mDislikeIcon.getMeasuredWidth() + this.i.leftMargin + this.i.rightMargin;
                v2 = Math.max(0, this.mDislikeIcon.getMeasuredHeight() + this.i.topMargin + this.i.bottomMargin);
            }

            if (this.u.x) {
                this.mMoreIcon.measure(InfoLayout.getChildMeasureSpec(arg14, this.w.leftMargin + v0 + this.w.rightMargin, this.w.width), InfoLayout.getChildMeasureSpec(arg15, this.w.topMargin + v10 + this.w.bottomMargin, this.w.height));
                v1 -= this.mMoreIcon.getMeasuredWidth() + this.w.leftMargin + this.w.rightMargin;
                v0 += this.mMoreIcon.getMeasuredWidth() + this.w.leftMargin + this.w.rightMargin;
                v2 = Math.max(v2, this.mMoreIcon.getMeasuredHeight() + this.w.topMargin + this.w.bottomMargin);
                v6 = v0;
            } else {
                v6 = v0;
            }

            if (this.u.u) {
                this.j.measure(InfoLayout.getChildMeasureSpec(arg14, this.k.leftMargin + v6 + this.k.rightMargin, this.k.width), InfoLayout.getChildMeasureSpec(arg15, this.k.topMargin + v10 + this.k.bottomMargin, this.k.height));
                v1 -= this.j.getMeasuredWidth() + this.k.leftMargin + this.k.rightMargin;
                v7 = Math.max(v2, this.j.getMeasuredHeight() + this.k.topMargin + this.k.bottomMargin);
                v2 = v1;
            } else {
                v7 = v2;
                v2 = v1;
            }

            if (this.u.v) {
                if (this.F.b != null && this.F.b.length() >= 2) {
                    v0_1 = this.F;
                    v1_1 = this.F;
                    v3 = ((int) UIUtils.dp2px(this.getContext(), 3f));
                    v1_1.e = v3;
                    v0_1.c = v3;
                }

                InfoLayout.a(this.F, this.u.c, v2, this.n, this.o, this.p);
                if (this.F.a) {

                } else {
                    v2 = v2 - this.F.g - this.mCommonTxtGap;
                    v7 = Math.max(this.F.h, v7);
                }
            }

            if (this.u.y) {
                if (this.mForegroundImageView.getVisibility() == View.VISIBLE) {
                    this.mForegroundImageView.measure(InfoLayout.getChildMeasureSpec(arg14, this.mForegroundImageLayoutParams.leftMargin + v6 + this.mForegroundImageLayoutParams.rightMargin, this.mForegroundImageLayoutParams.width), InfoLayout.getChildMeasureSpec(arg15, this.mForegroundImageLayoutParams.topMargin + v10 + this.mForegroundImageLayoutParams.bottomMargin, this.mForegroundImageLayoutParams.height));
                    v2 -= this.mForegroundImageView.getMeasuredWidth() + this.mForegroundImageLayoutParams.leftMargin + this.mForegroundImageLayoutParams.rightMargin;
                    v7 = Math.max(v7, this.mForegroundImageView.getMeasuredHeight() + this.mForegroundImageLayoutParams.topMargin + this.mForegroundImageLayoutParams.bottomMargin);
                } else if (this.e.getVisibility() == View.VISIBLE) {
                    this.e.measure(InfoLayout.getChildMeasureSpec(arg14, this.f.leftMargin + v6 + this.f.rightMargin, this.f.width), InfoLayout.getChildMeasureSpec(arg15, this.f.topMargin + v10 + this.f.bottomMargin, this.f.height));
                    v2 -= this.e.getMeasuredWidth() + this.f.leftMargin + this.f.rightMargin;
                    v7 = Math.max(v7, this.e.getMeasuredHeight() + this.f.topMargin + this.f.bottomMargin);
                }
            }

            int[] v11 = InfoLayout.d;
            int v8 = 0;
            v6 = v2;
            while (v8 < 5) {
                v0 = v11[v8];
                b v12 = this.c[v0];
                if (v12.b) {
                    v2 = v0 == 1 ? Math.min(this.C, v6) : v6;
                    if (this.F.b != null && this.F.b.length() >= 2) {
                        v0_1 = this.F;
                        v1_1 = this.F;
                        v3 = ((int) UIUtils.dp2px(this.getContext(), 3f));
                        v1_1.e = v3;
                        v0_1.c = v3;
                    }

                    InfoLayout.a(v12.a, v12.c, v2, this.mCommonTxtPaint, this.r, this.s);
                    if (v12.a.a) {
                        v0 = v7;
                    } else {
                        v6 = v6 - v12.a.g - this.mCommonTxtGap;
                        v0 = Math.max(v12.a.h, v7);
                    }
                } else {
                    v0 = v7;
                }

                ++v8;
                v7 = v0;
            }

            this.setMeasuredDimension(Math.max(InfoLayout.resolveSize(v9, arg14), this.getSuggestedMinimumWidth()), Math.max(InfoLayout.resolveSize(v10 + v7, arg15), this.getSuggestedMinimumHeight()));
        }
    }

    public void setCommonTxtColorResId(int resId) {
        this.mCommonTxtColorResId = resId;
    }

    public void setCommonTxtGap(int gap) {
        this.mCommonTxtGap = gap;
    }

    public void setCommonTxtPaintTypeFace(Typeface typeface) {
        this.mCommonTxtPaint.setTypeface(typeface);
    }

    public void setDislikeOnClickListener(View.OnClickListener onClickListener) {
        this.mDislikeIcon.setOnClickListener(onClickListener);
    }

    public void setMoreActionClickListener(View.OnClickListener listener) {
        if (this.mMoreIcon != null) {
            this.mMoreIcon.setOnClickListener(listener);
        }
    }

    public void setSourceIconHeight(int arg1) {
        this.mSourceIconHeight = arg1;
    }

    public void setSourceIconMaxWidth(int arg1) {
        this.mSourceIconMaxWidth = arg1;
    }
}

